# 在该文件在验证同时按下多个键的可行性
 
import time

''' 失败
import pydirectinput;
for i in range(100):
    pydirectinput.keyDown('q');
    pydirectinput.keyDown('h');
    pydirectinput.keyUp('q');
    pydirectinput.keyUp('h');
    time.sleep(5);
'''    
''' 成功+部分失败
import pyautogui
for i in range(10):
    time.sleep(5)
    # 失败，非同时按下1
    #pyautogui.press('q')
    #pyautogui.press('h')
    
    # 失败，非同时按下2
    #pyautogui.keyDown('q')
    #pyautogui.keyDown('h')
    #pyautogui.keyDown('r')
    #pyautogui.keyUp('q')
    #pyautogui.keyUp('h')
    #pyautogui.keyUp('r')
    
    # 成功，同时按下
    # 虽然官方文档说hotkey() is equivalent to 非同时按下2，实际测试并不相同！。
    pyautogui.hotkey('q', 'h','f') 
    
    # 失败，接受自定义参数错误
    #a = ['q', 'h','f']
    #pyautogui.hotkey(a)  
    #b = ('q', 'h','f')
    #pyautogui.hotkey(b)
 '''
 
# 成功，并且参数方便自定义，鼓掌！
import keyboard
for i in range(10):
    time.sleep(3)
    keyboard.press('q+h+f') 
    keyboard.release('q+h+f')